import Entity from './entity'

export default class Config extends Entity {
    constructor(db) {
        super(db, 'configs')
    }

    async getAll() {
        const configs = await this.find({})
        return configs[0] || {}
    }

    async save(configType, configValue) {
        await this.collection.update({}, { $set: { [configType]: configValue } })
    }
}